package com.sky.merchant.domain;

import lombok.Data;

import javax.validation.constraints.*;
import java.util.List;

@Data
public class UserEntity {
    @Null(message = "ID应该在创建时由系统生成，不应手动指定")
    private Long id;

    @NotNull(message = "用户名不能为空")
    @Size(min = 3, max = 20, message = "用户名长度必须在3到20个字符之间")
    private String username;

    @NotNull(message = "密码不能为空")
    @Size(min = 6, message = "密码长度必须至少为6个字符")
    private String password;

    @Min(value = 1, message = "年龄必须大于0岁")
    @Max(value = 150, message = "年龄不能超过150岁")
    private Integer age;

    @Email(message = "邮箱格式不正确")
    private String email;

    @NotEmpty(message = "用户必须至少有一个角色")
    private List<String> roles;

    @NotBlank(message = "用户简介不能为空且不能只包含空格")
    private String description;
}
//       {
//        "id": null,
//        "username": "exampleUser",
//        "password": "securePassword123",
//        "age": 25,
//        "email": "exampleUser@example.com",
//        "roles": ["USER", "ADMIN"],
//        "description": "这是一个示例用户简介。"
//        }